package com.guyaogg.gulimall.product.feign;

import com.guyaogg.common.to.SkuReductionTo;
import com.guyaogg.common.to.SpuBoundTo;
import com.guyaogg.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * spring cloud 远程调用过程
 *    1.# @RequestBody 将数据转化为 json
 *    2.找到 gulimall-coupon 微服务，给 /coupon/spubounds/save 发请求
 *          将上部 json 放入请求体位置，发送请求
 *    3.对方服务接收到请求。接收请求体中 json 数据
 *        # ( @RequestBody SpuBoundsEntity spuBounds) 将 json 数据转为对应 Java 对象
 *
 * 只有 json 数据模型是兼容的。双方服务无需使用同一个 to
 *
 * @author 顾遥
 */
@FeignClient("gulimall-coupon")
public interface CouponFeignService {


    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);

    @PostMapping("/coupon/skufullreduction/save/info")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
